package com.mutual.assistance.task.config;

import com.mutual.assistance.task.constant.StringConstant;
import com.mutual.assistance.utils.ThreadLocalUtils;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenyuxin
 * @version 1.0
 * @description OpenFeign拦截器添加请求头
 * @date 2023/4/30 0:27
 */
@Configuration
public class OpenFeignConfig implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        String token = ThreadLocalUtils.getToken();
        template.header(StringConstant.AUTHORIZATION, token);
    }

}
